package com.bhdx.blog.service.impl;

import com.bhdx.blog.dao.LinkDao;
import com.bhdx.blog.entity.Link;
import com.bhdx.blog.entity.PageBean;
import com.bhdx.blog.service.LinkService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;

/**
 * @author bhdx
 * @date 2020/6/16-16:58
 */
@Service("linkService")
public class LinkServiceImpl implements LinkService {
    @Resource
    private LinkDao linkDao;


    @Override
    public List<Link> getTotalData() {
        return linkDao.getTotalData();
    }

    @Override
    public PageBean<Link> listByPage(PageBean<Link> pageBean) {
        pageBean.setResult(linkDao.listByPage(pageBean.getStart(),pageBean.getEnd()));
        pageBean.setTotal(linkDao.getTotalCount());
        return pageBean;
    }

    @Override
    public Long getTotalCount() {
        return linkDao.getTotalCount();
    }

    @Override
    public Integer addLink(Link link) {
       return linkDao.addLink(link);
    }

    @Override
    public Integer deleteLink(Integer id) {
        return linkDao.deleteLink(id);
    }

    @Override
    public Integer updateLink(Link link) {
        return linkDao.updateLink(link);
    }
}
